﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ManageBanking.Areas.Admin.Models;

namespace ManageBanking.Areas.Admin.Controllers
{
    public class ManageAdminController : Controller
    {
        //
        // GET: /Admin/ManageAdmin/
        private ManageAdminModels mam = new ManageAdminModels();
        

        public ActionResult Paging()
        {
            if (Session["Admin"] != null)
            {
                ViewData["menuadmin"] = "AllUser";
                int totalUsername;
                ViewData["listuser"] = mam.ListUsername(out totalUsername);
                ViewData["totaluser"] = totalUsername == 0 ? 1 : totalUsername;
                ViewData["Check"] = Session["Check"];
                Session.Remove("Check");

                return View();
            }
            else
                return RedirectToAction("LoginAdmin", "LoginAdmin");

        }


        public ActionResult LockUser()
        {
            if (Session["Admin"] != null)
            {
                ViewData["menuadmin"] = "LockUser";
                int totalUsername;
                ViewData["listuser"] = mam.ListLockUsername(out totalUsername);
                ViewData["totaluser"] = totalUsername == 0 ? 1 : totalUsername;
                ViewData["Check"] = Session["Check"];
                Session.Remove("Check");
                return View();
            }
            else
                return RedirectToAction("LoginAdmin", "LoginAdmin");
        
        
        }


        public ActionResult UnlockUser()
        {
            if (Session["Admin"] != null)
            {
                ViewData["menuadmin"] = "UnLock";
                int totalUsername;
                ViewData["listuser"] = mam.ListUnlockUsername(out totalUsername);
                ViewData["totaluser"] = totalUsername == 0 ? 1 : totalUsername;
                ViewData["Check"] = Session["Check"];
                Session.Remove("Check");
                return View();
            }
            else
                return RedirectToAction("LoginAdmin", "LoginAdmin");

        }


        public ActionResult RequestAdmin()
        {
            if (Session["Admin"] != null)
            {
                ViewData["menuadmin"] = "RequestFromUser";
                int totalUsername;
                ViewData["listuser"] = mam.RequestAdmin(out totalUsername);
                ViewData["totaluser"] = totalUsername;
               
                    ViewData["Res"] = Session["Res"];
                Session.Remove("Res");
                return View();
            }
            else
                return RedirectToAction("LoginAdmin", "LoginAdmin");


        }



        

       
       

    }
}
